package tt.dz.egobus.servicemanager.core.registrar;

import org.apache.commons.lang3.StringUtils;
import tt.dz.egobus.servicemanager.util.NumberUtils;

import java.beans.PropertyEditorSupport;

/**
 * @author Anson
 * @date 17-3-15
 * @name BigDecimal 转换器
 * @since 1.0.1
 */
public class BigDecimalEditor extends PropertyEditorSupport {

    @Override
    public void setAsText(String text) throws IllegalArgumentException {
        if (StringUtils.isEmpty(text)) {
            setValue(null);
        } else {
            setValue(NumberUtils.getBigDecimal(text));
        }
    }
}